<%-- 
    Document   : ViewOrders
    Created on : Nov 22, 2012, 9:37:21 PM
    Author     : vupttse
--%>

<%@page import="ass.data.OrderDAL"%>
<%@page import="ass.data.UserDAL"%>
<%@page import="java.util.Collection"%>
<%@page import="ass.data.OrderEntity"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>View Orders</title>
        <link href="../css/modern.css" rel="stylesheet">
        <link href="../css/modern-responsive.css" rel="stylesheet">
        <link href="../css/site.css" rel="stylesheet" type="text/css">

        <script src="../js/jquery-1.8.2.min.js"></script>
        <script src="../js/google-analytics.js"></script>
        <script src="../js/github.info.js"></script>
        <script src="../js/sharrre/jquery.sharrre-1.3.4.min.js"></script>
        <script src="../js/carousel.js"></script>
        <script src="../js/dropdown.js"></script>
        <script src="../js/slider.js"></script>
        <script src="../js/hover.js"></script>
        <script src="../js/pagecontrol.js"></script>
        <script src="../js/accordion.js"></script>
    </head>
    <body>
        <div class="page with-sidebar">
            <%@include  file="Header.html" %>
            <%@include file="SideBar.html" %>

            <div class="page-region">
                <div class="page-region-content">
                    <div class="8">
                        <h1 class="fg-color-blue">Orders: </h1>
                        <table class="hovered" style="font-size: 8pt">
                            <tr>
                                <td>Username</td>
                                <td>Full-name</td>
                                <td>Gender</td>
                                <td>Address</td>
                                <td>Tel</td>
                                <td>Nationality</td>
                                <td></td>
                                <td></td>
                            </tr>
                            <%
                                try {
                                    Collection<OrderEntity> list = OrderDAL.listAll();
                                    if (list != null) {
                                        Iterator<UserEntity> it = list.iterator();
                                        while (it.hasNext()) {
                                            UserEntity entity = it.next();
                                            if (entity.getRole().trim().equals("Staff")) {%>
                            <tr>
                                <td><%=entity.getUsername()%></td>
                                <td><%=entity.getFullName()%></td>
                                <td><%=entity.getGender()%></td>
                                <td><%=entity.getAddress()%></td>
                                <td><%=entity.getTel()%></td>
                                <td><%=entity.getNationality()%></td>
                                <td><i class="icon-flag"></i><a href="ModifyStaff.jsp?username=<%=entity.getUsername().trim()%>">  Edit</a></td>
                                <td><i class="icon-remove"></i><a href="DeleteStaff.jsp?username=<%=entity.getUsername().trim()%>">  Remove</a></td>
                            </tr>
                            <%}
                                        }
                                    } else {
                                        out.println("NULL table!");
                                    }
                                } catch (Exception e) {
                                    out.println("Error: " + e.getMessage());
                                }
                            %>
                        </table>
                    </div>
                </div>
            </div>

            <%@include file="Footer.html" %>
        </div>
    </body>
</html>
